package edu.tamu.cs.studio;

import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;

public class Piece 
{
	private int x; // the X coordinate
	private int y; // the Y coordinate
	private boolean touched; // if droid is touched/picked up
	public Piece(int x, int y)
	{
		this.x = x;
		this.y = y;
	}
	//public Bitmap getBitmap() 
	//{
	//	return bitmap;
	//}
	//public void setBitmap(Bitmap bitmap) 
	//{
	//	this.bitmap = bitmap;
	//}
	public int getX() 
	{
		return x;
	}
	public void setX(int x) 
	{
		this.x = x;
	}
	public int getY() 
	{
		return y;
	}
	public void setY(int y)
	{
		this.y = y;
	}
	public boolean isTouched()
	{
		return touched;
	}
	public void setTouched(boolean touched) 
	{
		this.touched = touched;
	}
	public void draw(Canvas canvas) 
	{
		Paint paint = new Paint();
		paint.setColor(Color.WHITE);
		canvas.drawCircle(x, y,10, paint);
		//canvas.drawText(text, x, count, x, y, paint)
	}
	public void handleActionDown(int eventX, int eventY)
	{
		if (eventX >= (x - 5) && (eventX <= (x + 5))) 
		{
			if (eventY >= (y - 5) && (y <= (y + 5)))
			{
				// piece touched
				setTouched(true);
			} 
			else 
			{
				setTouched(false);
			}
		} 
		else 
		{
			setTouched(false);
		}
	}
}